\(\int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx\) [414]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 49 \[ \int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {x}{a}+\frac {\text {arctanh}(\cos (c+d x))}{a d}-\frac {\cos (c+d x)}{a d}-\frac {\cot (c+d x)}{a d} \]

[Out]

-x/a+arctanh(cos(d*x+c))/a/d-cos(d*x+c)/a/d-cot(d*x+c)/a/d

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {2918, 3554, 8, 2672, 327, 212} \[ \int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {\text {arctanh}(\cos (c+d x))}{a d}-\frac {\cos (c+d x)}{a d}-\frac {\cot (c+d x)}{a d}-\frac {x}{a} \]

[In]

Int[(Cos[c + d*x]^2*Cot[c + d*x]^2)/(a + a*Sin[c + d*x]),x]

[Out]

-(x/a) + ArcTanh[Cos[c + d*x]]/(a*d) - Cos[c + d*x]/(a*d) - Cot[c + d*x]/(a*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2918

Int[((cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.))/((a_) + (b_.)*sin[(e_.) + (f_
.)*(x_)]), x_Symbol] :> Dist[g^2/a, Int[(g*Cos[e + f*x])^(p - 2)*(d*Sin[e + f*x])^n, x], x] - Dist[g^2/(b*d),
Int[(g*Cos[e + f*x])^(p - 2)*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x] && EqQ[a^2
 - b^2, 0]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = -\frac {\int \cos (c+d x) \cot (c+d x) \, dx}{a}+\frac {\int \cot ^2(c+d x) \, dx}{a} \\ & = -\frac {\cot (c+d x)}{a d}-\frac {\int 1 \, dx}{a}+\frac {\text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\cos (c+d x)\right )}{a d} \\ & = -\frac {x}{a}-\frac {\cos (c+d x)}{a d}-\frac {\cot (c+d x)}{a d}+\frac {\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{a d} \\ & = -\frac {x}{a}+\frac {\text {arctanh}(\cos (c+d x))}{a d}-\frac {\cos (c+d x)}{a d}-\frac {\cot (c+d x)}{a d} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.03 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.90 \[ \int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {\left (1+\cot \left (\frac {1}{2} (c+d x)\right )\right )^2 \left (\cos (c+d x)+\left (c+d x+\cos (c+d x)-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )\right ) \sin (c+d x)\right ) \tan \left (\frac {1}{2} (c+d x)\right )}{2 a d (1+\sin (c+d x))} \]

[In]

Integrate[(Cos[c + d*x]^2*Cot[c + d*x]^2)/(a + a*Sin[c + d*x]),x]

[Out]

-1/2*((1 + Cot[(c + d*x)/2])^2*(Cos[c + d*x] + (c + d*x + Cos[c + d*x] - Log[Cos[(c + d*x)/2]] + Log[Sin[(c +
d*x)/2]])*Sin[c + d*x])*Tan[(c + d*x)/2])/(a*d*(1 + Sin[c + d*x]))

Maple [A] (verified)

Time = 0.26 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.35

method result size
parallelrisch \(\frac {-2 d x +2-2 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-2 \cos \left (d x +c \right )+2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\sec \left (\frac {d x}{2}+\frac {c}{2}\right ) \csc \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d a}\) \(66\)
derivativedivides \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {1}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-2 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {4}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}-4 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d a}\) \(73\)
default \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {1}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-2 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {4}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}-4 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d a}\) \(73\)
risch \(-\frac {x}{a}-\frac {{\mathrm e}^{i \left (d x +c \right )}}{2 a d}-\frac {{\mathrm e}^{-i \left (d x +c \right )}}{2 a d}-\frac {2 i}{a d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d a}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d a}\) \(103\)
norman \(\frac {-\frac {3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d a}-\frac {3 \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}-\frac {1}{2 a d}+\frac {\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d a}-\frac {x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a}-\frac {x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {2 x \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {2 x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {x \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {7 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d a}-\frac {5 \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d a}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}\) \(262\)

[In]

int(cos(d*x+c)^4*csc(d*x+c)^2/(a+a*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/2*(-2*d*x+2-2*ln(tan(1/2*d*x+1/2*c))-2*cos(d*x+c)+2*tan(1/2*d*x+1/2*c)-sec(1/2*d*x+1/2*c)*csc(1/2*d*x+1/2*c)
)/d/a

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.63 \[ \int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {2 \, {\left (d x + \cos \left (d x + c\right )\right )} \sin \left (d x + c\right ) - \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + 2 \, \cos \left (d x + c\right )}{2 \, a d \sin \left (d x + c\right )} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="fricas")

[Out]

-1/2*(2*(d*x + cos(d*x + c))*sin(d*x + c) - log(1/2*cos(d*x + c) + 1/2)*sin(d*x + c) + log(-1/2*cos(d*x + c) +
 1/2)*sin(d*x + c) + 2*cos(d*x + c))/(a*d*sin(d*x + c))

Sympy [F]

\[ \int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {\int \frac {\cos ^{4}{\left (c + d x \right )} \csc ^{2}{\left (c + d x \right )}}{\sin {\left (c + d x \right )} + 1}\, dx}{a} \]

[In]

integrate(cos(d*x+c)**4*csc(d*x+c)**2/(a+a*sin(d*x+c)),x)

[Out]

Integral(cos(c + d*x)**4*csc(c + d*x)**2/(sin(c + d*x) + 1), x)/a

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 154 vs. \(2 (49) = 98\).

Time = 0.31 (sec) , antiderivative size = 154, normalized size of antiderivative = 3.14 \[ \int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {\frac {\frac {4 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + 1}{\frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {a \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}} + \frac {4 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} + \frac {2 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}}{2 \, d} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*((4*sin(d*x + c)/(cos(d*x + c) + 1) + sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + 1)/(a*sin(d*x + c)/(cos(d*x +
 c) + 1) + a*sin(d*x + c)^3/(cos(d*x + c) + 1)^3) + 4*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a + 2*log(sin(d*
x + c)/(cos(d*x + c) + 1))/a - sin(d*x + c)/(a*(cos(d*x + c) + 1)))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 113 vs. \(2 (49) = 98\).

Time = 0.34 (sec) , antiderivative size = 113, normalized size of antiderivative = 2.31 \[ \int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {\frac {6 \, {\left (d x + c\right )}}{a} + \frac {6 \, \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a} - \frac {3 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a} - \frac {2 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 10 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )} a}}{6 \, d} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="giac")

[Out]

-1/6*(6*(d*x + c)/a + 6*log(abs(tan(1/2*d*x + 1/2*c)))/a - 3*tan(1/2*d*x + 1/2*c)/a - (2*tan(1/2*d*x + 1/2*c)^
3 - 3*tan(1/2*d*x + 1/2*c)^2 - 10*tan(1/2*d*x + 1/2*c) - 3)/((tan(1/2*d*x + 1/2*c)^3 + tan(1/2*d*x + 1/2*c))*a
))/d

Mupad [B] (verification not implemented)

Time = 10.04 (sec) , antiderivative size = 147, normalized size of antiderivative = 3.00 \[ \int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {2\,\mathrm {atan}\left (\frac {4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-4}+\frac {4}{4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-4}\right )}{a\,d}-\frac {\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{a\,d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+1}{d\,\left (2\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+2\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,a\,d} \]

[In]

int(cos(c + d*x)^4/(sin(c + d*x)^2*(a + a*sin(c + d*x))),x)

[Out]

(2*atan((4*tan(c/2 + (d*x)/2))/(4*tan(c/2 + (d*x)/2) - 4) + 4/(4*tan(c/2 + (d*x)/2) - 4)))/(a*d) - log(tan(c/2
 + (d*x)/2))/(a*d) - (4*tan(c/2 + (d*x)/2) + tan(c/2 + (d*x)/2)^2 + 1)/(d*(2*a*tan(c/2 + (d*x)/2) + 2*a*tan(c/
2 + (d*x)/2)^3)) + tan(c/2 + (d*x)/2)/(2*a*d)